# -*- coding:utf-8 -*-


class MarketManageSql(object):
    """市场运营相关SQL"""
    
    # 市场运营列表
    MARKET_LIST = "SELECT u.user_name, m.market_source,c.customer_name," \
                  "p.name,p.status,p.create_date,p.plane_time,m.id FROM public.marketmanage as m " \
                  "INNER JOIN user_info as u ON m.market_create_user=u.id " \
                  "INNER JOIN customer as c ON m.market_customer=c.id " \
                  "INNER JOIN project as p ON m.project_id=p.id "
    
    # 添加市场信息
    ADD_MARKET = "INSERT INTO marketmanage(market_customer, market_create_user, market_source," \
                 " project_id) VALUES (%s, %s, %s, %s);"
    
    # 添加项目
    ADD_PROJECT = "INSERT INTO project(name, status, create_date) VALUES (%s,%s,%s,%s,%s)returning id"
    
    # 查看任务详情信息
    MARKET_INFO = "SELECT * FROM marketmanage"
    
    # 查看任务日报
    MARKET_REPORT = "SELECT report_info, report_creat_time, ui.user_name FROM report " \
                    "LEFT JOIN user_info ui " \
                    "ON report.report_user_id = ui.id " \
                    "WHERE report_classfy_id = %s " \
                    "AND report.id = %s "
    
    # 新增客户信息
    ADD_CUSTOMER = 'INSERT INTO customer(customer_name, customer_tel, company_name, area, source) ' \
                   'VALUES(%s, %s, %s, %s, %s) '
    
    # 查看客户信息
    CUSTOMER_LIST = "SELECT * FROM customer"